<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

Route::group('v1',function (){
    //登入
    Route::post('/login', 'LoginController/login');
    //注册
    Route::post('/user', 'UserController/insertUser');
    //首页
    Route::get('/posts', 'PostsController/getIndexPosts');

    Route::group('',function (){
        //用户
        Route::get('/user', 'UserController/getUser');
        Route::put('/user', 'UserController/updateUser');
        //修改头像
        Route::post('/headimg', 'UserController/updateHeadImg');
        //退出登入
        Route::delete('/sign_out', 'LoginController/signOut');

        //帖子
        Route::get('/posts/user', 'PostsController/getUserPosts');
        Route::get('/info', 'PostsController/getPostsInfo');
        Route::post('/posts', 'PostsController/insertPosts');
        Route::delete('/posts', 'PostsController/delPosts');
        Route::post('/comment/posts', 'PostsController/commentPost');
        Route::post('/comment/info', 'PostsController/commentInfo');
    })->middleware(\app\middleware\Check::class);

})->middleware(\app\middleware\Cross::class);





